Is it possible to execute a stored procedure for each row in a SELECT? This only executes the first row, looking for something to execute for all rows:
Declare
@Loop bit = 1, @ID int, @Exists bit, @ReturnValue bit = 0
WHILE (@Loop) = 1
BEGIN
SELECT @ID = ID FROM Table --Multiple Rows Returned
EXEC [dbo].[StoredProc1] --Exec SP for Each Row
@InputID = @ID
,@Exists = @Exists OUTPUT
IF @Exists = 1
BEGIN
SET @Loop = 0
SET @ReturnValue = 1
END
END
SELECT @ReturnValue [ReturnValue]