Answer by Magnus Ahlkvist ·
There's not much to work on in your question.
But to narrow it down.
1) A temp table and a common table expression can be joined, either in another common table expression or in the outer query, referencing the common table expression.
2) Since you can use SELECT-statements in stored procedures (as well as updates, inserts, deletes and most other TSQL-commands), then yes, you can join a CTE with a temporary table inside a stored procedure, just as long as the temporary table exists in the scope of the stored procedure execution.