I've verified your sample and its indeed truncating the result to 512 characters. I think SQL Agent's default TEXTSIZE is 1024, whereas SSMS' default size is 2147483647. So, you should try setting the TEXTSIZE option in the procedure itself. I tried myself and its working.
--Ramesh