SELECT OBJECTPROPERTY(object_id('TableToBeChecked'), 'TableHasIdentity')
SMO
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];
Table tb = new Table(db, "Test Table");
Column col1 = new Column(tb, "TableIdentifier", DataType.Int);
col1.Identity = true;
tb.Columns.Add(col1);
try
{
foreach (String s in tb.CheckIdentityValue())
{
Console.WriteLine(s);
}
}
catch
{
}