using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
namespace AddColumn
{
    class Program
    {
        static void Main(string[] args)
        {
            Server local = new Server();
            Database scratch = local.Databases["scratch"];
            local.ConnectionContext.SqlExecutionModes = SqlExecutionModes.CaptureSql;
            Table Invoices = scratch.Tables["Invoices"];
            Column size = new Column(Invoices, "Size", DataType.Int);
            Invoices.Columns.Add(size);
            Invoices.Alter();
            StringCollection s3 = local.ConnectionContext.CapturedSql.Text;
            foreach (string s in s3)
            {
                Console.WriteLine(s);
            }
            Scripter scripter = new Scripter(local);
            ScriptingOptions so = new ScriptingOptions();

            StringCollection sc;// = Invoices.Script(SoapMethodCollectionBase);
            sc = scripter.Script(new SqlSmoObject[] {Invoices}); 
            
            foreach (String s in sc)
            {
                Console.WriteLine(s);
            }
        }
    }
}
