• select @@identity returns last inserted value of the current session. I think your prepared statement is run in one session and the select @@identity in another.

    "Keep Trying"