I have this simple code
declare @a int, @b int
select @a=sum(1), @b=1 from syscolumns where 1 = 2
select @@rowcount, @a, @b
The result is : @@rowcount=1, @a=null, @b=1
@a = null is fine to me, but how come @@rowcount and @b=1
SQLFiddle : https://rextester.com/PKCB94229