I want to take all stored procedures and create them under a new name. My problem is with procedures that are called from other procedures .
To rename a procedure is no problem for me. But to change/duplicate the procedures that still reference them by their old names is a problem.
For example:
CREATE PROCEDURE dbo.getdata
AS
BEGIN
EXECUTE dbo.up_updatetable ;
END;
Best Answer
How about such a little script, to generate new scripts for all procedures, replacing all old names with new names (definition and calls):
Then you can execute all the scripts, either by hand, or using a cursor (more prefered for hundreds of procs).
But begin with checking carefully at least a couple of scripts before executing them.