• With a little more research you would have found sys.sql_modules which has the advantage of the definition field being nvarchar(max) so sprocs > 8k do not need to be reassembled.

    As posted your solution will not work in SQL 2k anyway since you use varbinary(max).

    Also I do not understand why you are using varbinary instead of nvarchar. Then the built in replace function would work as expected.

    All that being said: overall kudos for showing how a smart DBA can simplify complex tasks using SQL.

    "Real DBAs don't write code, they write code that writes code for them"