SQL data doesn't have any inherent order, so you need to define it yourself, which you can do using ROW_NUMBER()
SELECT @BaseProductId, Id, Row_Number() OVER (ORDER BY ....),
@UserId, GETUTCDATE(), @UserID, GETUTCDATE() FROM @ImageIDs;
You need to specify the ordering you require in the syntax