DECLARE @SPID AS INT
DECLARE @COUNT AS INT=0

DECLARE curSPID CURSOR FOR
select SPID
from master.sys.sysprocesses
Where  status='sleeping' and waittype=0x0000 and open_tran>0

OPEN curSPID
FETCH NEXT FROM curSPID INTO @SPID

WHILE @@FETCH_STATUS = 0
BEGIN
	EXEC('KILL '+ @SPID)
	SET @COUNT+=1
	PRINT 'KILL '+ CAST(@SPID AS VARCHAR)
	FETCH NEXT FROM curSPID INTO @SPID
END
PRINT 'KILL COUNT：'+ CAST(@COUNT AS VARCHAR)
CLOSE curSPID
DEALLOCATE curSPID