rightontarget (12/4/2013)
but then I will have to edit every procedure to make sure that joins point to test instance of the database.
so your procedures are using three part naming conventions to explicitly identify the database? is that the problem? ie SELECT * from Production.dbo.Table 1 Inner Join Production.dbo.table2?
or you also have cross database queries, that join, say the Production database and CommonSecurity database?
i could see how that would be an issue; i'd end up putting something together that did a find-replace-alter on all the stored procs in that case, and make it something reusable.
I have a sample fo that somewhere, using a cursor, if you thought that might help, but it assumes certain conventions, like the definitiosn are "CREATE PROCEDURE" with a single space between them, which you might need to change depending on your style of coding procs/functions
Lowell