I wrote the stored procedure below for a customer recently, and when I called it from .NET it brought back a truncated result. More, when I looked into it, it was actually splitting the result onto several lines, with a max of 2033 characters on each line.
The solution is below.