In general, if your code is not (yet) doing what you need it to do, then it is "not working code" with respect to Code Review. On Code Review, we require "working" code - code which not only runs, code which not only produces results, but also it has to produce the results you want. If your question is about making existing code do something new, or different, or to add a new feature, then it is not ready for a Code Review, and is thus off-topic here.
Your actual question is:
I need to adjust this @Compare in outer APPLY, so I get it for each line. However I don't want my result to change other then getting another column @Compare.
Once you have the code doing what you want it to do, then you should feel free to bring it here for review, and we can help accomplish the same results, but better ;-)