I don't quite understand the concept you're reaching for.
How, in SQL Server, would you have a temporary view? They don't exist.
What you do have are derived tables, subqueries. i.e. inline SQL statements.
That's what you had in code surely. Building up the SQL statement - you can then use it...