Use my code, the only thing you need to do is to replace the the text schema.procedure with the name of your procedure eg. dbo.thisismyprocedure
Then remove the spaces between the '& # x 0 D ;'
The last step should be exec sp_executesql @sql do not change that line.