0) Allow the user to specify the column names and types.
1) Create a collection of an object that store your column names and types. Make sure you add code to prevent duplicate column names. There are several techniques you can use to black-box this code so you can hide validation complexity. I'll let you be a programmer and finger out how much validation is necessary, and where it should be implemented.
2) Build a string that represents the desired query.
string userTable = "MyTable";
HashSet columns = new HashSet<string,string>();
StringBuilder query = new StringBuilder();
query.AppendFormat("IF OBJECT_ID('{0}','U') IS NOT NULL DROP TABLE dbo.{0}; ", userTable).AppendLine();
query.AppendFormat("CREATE TABLE dbo.{0} (", userTable);
MyColumnItem lastColumn = columns.Last();
foreach(MyColumnItem item in columns)
{
query.AppendFormat("{0} {1}", item.ColumnName, item.ColumnType);
it (!item.Equals(lastItem)
{
query.Append(",");
}
}
query.Append(");");
3) Use ADO classes to execute the query.