Are you able to cast as XML? I use that for OBJECT_DEFINITION, eg.
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.