List all the stored procedures which does not have SET NOCOUNT ON statement.

SELECT DISTINCT
obJECT_NAME(id)
FROM syscomments c
INNER JOIN sys.objects o ON c.id = o.object_id
WHERE text NOT LIKE '%SET NOCOUNT ON%'
AND type = 'P'
AND id NOT IN ( SELECT id
FROM syscomments c
INNER JOIN sys.objects o ON c.id = o.object_id
WHERE text LIKE '%SET NOCOUNT ON%'
AND type = 'P' )

Comments