Sql-server – How are these tempdb tables automatically created after each SQL Server restart

sql serverstored-procedurestempdb

I have a session state management implementation using SQL Server. There is an ASPState database, and ASPStateTempApplications & ASPStateTempSessions tables in the tempdb database.

When I restart the SQL Service, tempdb database recreates, but these tables recreate too. I want to know: how do these tables recreate automatically each time?

I looked for start-up parameters and jobs, but did not find any.

Best Answer

Thanks for your input. Actually, I found the answer:

Those tables were created by a stored procedure that is set to execute on startup of the database engine service, configured via the sp_procoption system stored procedure.