1. First Create a variable "ProductList" as Object Type.
2. Create a string variable "ProductName"
3. Get SQL Task that produces Distinct List of products that you would like to pass to SP. And assign the task result set of Full Row Set to "ProductList" variable
4. Get For Each Loop with collection as Foreach ADO Enumerator
Select "ProductList" as the "ADO Object source variable". On the variable mappings select "ProductName" with index 0.
5. Add SQL Task inside and Create Table on Excel. Also make expression for "SQL Statement Source" to get table name dynamic.. A sample expression can be :
"CREATE " + @[User::ProductName] + "\n" +
"("+"\n" +
"ID Nvarchar(255) " + "\n" +
"Name Nvarchar(255) " +"\n"+
"Cose Nvarchar(255) " +"\n"+
")"
6. Add DataFlow Task and set Delay Validation as true
7. Add Source OLEDB and set SQL Command as :
EXEC sp_Name ?
Now map paramter to ProductName variable.
8. Create Excel Destination and set "Data Access Mode" as "Table or view name from variable" and select ProductName variable.
Map the required columns.