This is easy enough to do without a cursor:
--======
SET NOCOUNT ON
select N'
----------------------------------------------------------------------------
-- ' + p.name + N'
----------------------------------------------------------------------------
' + m.definition + N'
GO
----------------------------------------------------------------------------
'
from sys.sql_modules m
join sys.procedures p
ON p.object_id = m.object_id
WHERE is_ms_shipped = 0
AND left(p.name, 2) = 'sp' -- might not want this!! Change as needed.
ORDER BY p.name
Heck, you could even make it into a view.
The problem with both of these routines, however, is that they will get cut off at whatever your text output column display width is set to and that cannot be set higher than 8000. To fix this you need a specialized Split() function.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]