I want to do this in code, not with ALT+F1.
Adjust the WHERE clause to suit:
WHERE
select a.name as TableName, b.name as IdentityColumn from sysobjects a inner join syscolumns b on a.id = b.id where columnproperty(a.id, b.name, 'isIdentity') = 1 and objectproperty(a.id, 'isTable') = 1