• You have a ton of in-line function calls, those have to be evaluated for each row. Figure out a way to replace those: maybe set up a temp table / CTE to load with the results from the selected rows. Think about setting up table-valued functions rather than scalar ones.