DECLARE tables_cursor CURSOR
FOR
select spid from master..sysprocesses where dbid=db_id('test')
OPEN tables_cursor
DECLARE @tablename sysname
FETCH NEXT FROM tables_cursor INTO @tablename
WHILE (@@FETCH_STATUS <> -1)
BEGIN
exec ('kill '+ @tablename)
FETCH NEXT FROM tables_cursor INTO @tablename
END
Close tables_cursor
DEALLOCATE tables_cursor