If you want to get the last ID of an identity field in SQL you can use SCOPE_IDENTITY()
For example:
INSERT INTO table1(field1)
VALUES ('test')
SELECT SCOPE_IDENTITY() AS NewestID
If you want to do this later on, not when inserting a record you would just find the max ID
SELECT MAX(ID) AS LastID
FROM table1