In modern versions of SQL Server (2014+) you can create the indexes when you create the table, e. EGg.:
create table #t(id int primary key, a int, index ix_a nonclustered(a))
Also you can create the temp table before the snapshot transaction starts.
Almost all DDL is prohibited within a SNAPSHOT
transaction. ALTER TABLE
and TRUNCATE TABLE
are obviously not allowable. CREATE TABLE
is whitelisted. CREATE INDEX
could be whitelisted, but simply isn't.