The .sqlplan files for the queries that I put in the first message are attached.
MainDocumentAndAddendaActualPlan.sqlplan is from the first query
MainDocumentAndDiagnosesActualPlan.sqlplan is from the second query
MainDocumentAddendaAndDiagnosesEstimatedPlan.sqlplan is from the third query
MainDocumentAndAddendaIntoTempTableActualPlan.sqlplan is from saving the first query results in a temp table
MainDocumentAndDiagnosesIntoTempTableActualPlan.sqlplan is from saving the second query results in a temp table
MainDocumentAddendaAndDiagnosesFromTempTablesActualPlan.sqlplan is like the third query, but it uses the temp tables. That query looks like this:
SELECT doc_ad.TIUDocumentSID, doc_ad.ScrSSN, doc_ad.TIUDocumentSID, doc_dx.ICDCode
FROM #DocAndAdID AS doc_ad
LEFT JOIN #DocAndDxID AS doc_dx
ON doc_ad.TIUDocumentSID = doc_dx.TIUDocumentSID
ORDER BY doc_ad.TIUDocumentSID, doc_ad.TIUAddendumSID