Roman's Weekly SQL Server Tip - How to determine whether the table has an identity column in code
I had to do this recently in one of my utility stored procedures so I thought it would make a good tip. If you need to programatically determine whether the table has an identity column, you can use the OBJECTPROPERTY function and ask for the value of the 'TableHasIdentity' property:
SELECT OBJECTPROPERTY(object_id('MyTable'), 'TableHasIdentity')
SQL Server returns 1 if the table has an identity column, 0 if it doesn't.