by Semaphor · 2y ago · 0 comments
select name,cast((select OBJECT_DEFINITION(object_id) for xml path('')) as xml) from sys.procedures
This can be easier to straighten out since it preserves the newlines though other XML characters get mangled like > to >. One other option is VARBINARY plus something to un-hex it.