Good day @Bone_12
In such cases where you have a query which return the result set you need but you want to do another step of processing you can use Common Table Expression (CTE).
You can simply wrap your entire query into a CTE section and treat it as virtual table which you can query. In the outside query you can use simple SELECT from the CTE and add ORDER BY
You can read more about using CTE in this doc:
https://learn.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql?view=sql-server-ver15
If you will provide queries to create your table and insert some sample data + your current query then we could show you how this is done in your specific case
In general it should look like this
;With MyCTE as ( <enter your query here and make sure all columns has explicit names and no use of ORDER BY here> )
SELECT * FROM MyCTE
ORDER BY ID