title: How to create a duplicate copy of a SQL Server stored proc or view with a new name?
body: <p>Suppose I have a stored procedure proc_MyTestProc.</p>
  
  <p>I want to create a backup copy of this proc called proc_MyTestProc_{timestamp}, and create a new instance of this proc in its place. Here is my current method:</p>
  
  <ol>
  <li>Run sp_rename on proc_MyTestProc, appending the timestamp.</li>
  <li>Run the new CREATE script for the new version of proc_MyTestProc.</li>
  </ol>
  
  <p>The problem with this method is that it doesn't work with replication. The original procedure retains the same object ID. The procedure created in step #2 is what I want to be replicated to another DB, yet it has a new object ID, so it doesn't replicate.</p>
  
  <p>Is there an alternative to SP_RENAME that creates a copy of the object with a new object ID?</p>
  
  <p>I am running SQL Server 2005.</p>