your batch file is updated here (it will work for> 8000 characters, but this limit is easy to configure):
for /f %%a in (sp_list.txt) do sqlcmd -E -S SERVER -d DB -h-1 -Q "DECLARE @I INT, @SP1 NVARCHAR(4000), @SP2 NVARCHAR(4000) SET @I = 0 SET @SP1 = '' SET @SP2 = '' SELECT @I = @I + 1, @SP1 = CASE WHEN @I = 1 THEN text ELSE @SP1 END, @SP2 = CASE WHEN @I = 2 THEN text ELSE @SP2 END from dbo.syscomments WHERE id = OBJECT_ID('%%a') SELECT @SP1+@SP2" -o "%%a.sql"
I am personally concerned about such large procedures.
this is a limitation, but if you have stored procedures with line numbers longer than 4000 characters, you probably have a lot more problems than you can solve by reading this blog ... none of my stored procedures have lines longer than 150 characters, so for most people this probably doesn't matter much. As I said, if your lines take so long, you have more problems!
Adam Machanik - Reflect TSQL Procedure
but there are also thoughts that large procedures are not a problem:
"" NVARCHAR (4000), 4000 . , , 4000 . Solomon Rutzky -