Dynamically create SQL Server tables and populate them

Linking a relevant answer: