Some how I removed a WHERE in my query for this short verison. The actual stored proc reads: DECLARE @NoCategory int SELECT @NoCategory = COUNT(*) FROM table WHERE CategoryID IS NULL /* print @NoCategory */ RETURN @NoCategory