I agree that there are better solutions, this script helps you when you have a legacy system that you didn't design. We all have those.
Btw, be careful with the replace command. If you have "CREATE TABLE" statements in your stored procedures, this will change them to "ALTER" table statements.
I solved this by finding the words CREATE PROCEDURE, CREATE PROC, CREATE TRIGGER, CREATE FUNCTION, etc with several variations (like 2 and 3 spaces between the words -- remember I didn't write these!). Regular expressions might be a better solution, but mine works.
I made sure that my script replaced all known variations in production until the changed rows matches the number of procedures in production.