I am trying to use the Kill command dynamically in a scheduled job. I have built a small script that does the following:
SET @ParmDefinition = N'@pid smallint'
-- load up SQLString once
SET @SQLString = N'KILL @pid'
............... ...
-- kill the process
EXECUTE sp_executesql @SQLString, @ParmDefinition , @pid = @spSpid
Note, @spSpid (smallint as well) is loaded...