the issue is that TRY_CAST function with ON Clause. SQL Serve not allow TRY_CAST function dircetly in ON Clause. use as below this
1- Where TRY_CAST(ef.AutoQAItem as uniqueidentifier) = lr.useCaseId