Something like this will work:
DECLARE @spid_table TABLE (spid smallint)
DECLARE @spid smallint,
@kill nvarchar(11)
INSERT INTO @spid_table
SELECT spid FROM master..sysprocesses
WHERE dbid=DB_ID(db_name()) AND spid <> @@spid
WHILE (SELECT count(spid) FROM @spid_table) > 0
BEGIN
SET @spid = (SELECT TOP 1...