declare @count int, @a int
exec sp_executesql  N'select  @a = count(*)  from authors ', 
N'@a int output', @a output
select @count = @a
select @count