How do I write and SQL statement to pull a list of ID's and then execute a stored procedure against each of those IDs? Specifically I need the Scope_Identity() ID for each record after it get's inserted. However, the insert is done, based on a list of different IDs. So the order of events would be. 1. Select a list of IDs, 2. Do an insert into a table using those ID's (and some other information), 3. Execute a stored procedure using the Scope_Identity generated after each insert was performed. So i need a loop and then an inner loop. How do I do this in T-SQL?