SQL OBJECT_DEFINITION returns stored procedure text for editing

I've been using OBJECT_DEFINITION for a long time now, and it has been outputting text of stored procedures to the results grid in a nice and readable format (just like sp_helptext).

Yesterday, I upgraded my machine to Windows 10, and had to reinstall SQL Server (management studio). Now all of a sudden OBJECT_DEFINITION is outputting the entire store procedure text in one line, completely unreadable. How do I make it continue to return text to the results grid in a readable format like sp_helptext.

Extra Details
I have a stored procedure I wrote called "sp_prepareSP" which uses OBJECT_DEFINITION to retrieve the stored procedure text. It then appends text before and after the returned text. Things like "IF EXISTS(...) DROP PROCEDURE", and other things like at the end "GRANT EXECUTE ON ...".
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It works for me. What version of SSMS you have installed?
pzozulkaAuthor Commented:
2016. Had 2014 before reinstalled ssms.
Do you use "results to grid" or "results to text"?
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

pzozulkaAuthor Commented:
Only results to grid. I need this to work using grid.
I think it still should be fine. What happens when you select it and then paste it to a text editor? The difference between the OBJECT_DEFINITION and sp_helptext is that the former returns a text blob in a single row, and the latter is returns a table with each line in a row:
ssmsI have got ssms2014 - they release new products too fast for me to test them all
pzozulkaAuthor Commented:
When I paste it into the query window it shows up as a single line.
It must be a bug in ssms2016 then.
No, it is not a bug. It is a feature.
Check this article out. They now have a setting "Retain CR/LF on copy or save". Try it:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pzozulkaAuthor Commented:
That worked. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.