It's a session option a table can only have the option on for any one table at a time but multiple different sessions can have it on for the same table (not sure that would ever be a good idea though!)
When a child batch finishes (that sets this option) it looks like it automatically gets unset for the connection.
CREATE TABLE Tst (C INT IDENTITY(1,1)) EXEC('SET IDENTITY_INSERT Tst ON') INSERT INTO Tst(C) VALUES (1) /*Fails - Complains IDENTITY_INSERT is off*/ SET IDENTITY_INSERT Tst ON EXEC('INSERT INTO Tst(C) VALUES (1)') /*Succeeds this way round*/ SET IDENTITY_INSERT Tst OFF SET IDENTITY_INSERT Tst ON EXEC('SET IDENTITY_INSERT Tst ON; INSERT INTO Tst(C) VALUES (1);') /* Also succeeds like this*/