• You would have to wait for the scripttask to process all rows and set variable value after endofrowset.

    Since you are already using stored procedure here, why not just insert the new data via procedure and let the proc return the inserted.id or SCOPE_IDENTITY() as an output variable. You can use these output values directly in the dataflow by using OleDBCommand task.

    Also you might want to have a look at the following articles by Todd McDermid:

    "Todd MCDermid - Inserting Records AND Getting the Identity in SSIS"

    Part 1

    Part 2