CREAT PROCEDURE tester AS BEGIN SET NOCOUNT ON; DECLARE @userId varchar(50) DECLARE @count int SET @count = 0 SELECT @count = count(*) FROM UserService_User WHERE Account like '%111%' WHILE @count > 0 BEGIN SELECT @userId = Id FROM UserService_User WHERE Account like '%111%' exec UserService_RemoveUserByUserId @userId SET @count = @count -1 END END