In reply to wainright:
. I had this 25 years ago and can empathise.
Generally it’s a weakness/shortness and overuse injury.
The pain emanates from the ITB snapping over the lateral femoral epicondylle ( bony bit on the outside of your knee).
You are best being assessed to find out what’s weak and short (muscle wise) but here’s a helpful starter.
Descend any stairs with the painful leg first and don’t step past it with the other leg so that the painful leg doesn’t bend.
Ascend with the good leg first so that it takes all the load.
Avoid any painful activities, walking on hills/ cycling/ anything where the knee has to bend under load.
Ice it as per icing guidelines.
Strengthen your core. Beginners Pilates exercises.
Google side lying clams and do until fatigue, multiple sets on both legs plus bridging if you can.
Stretch your quads in prone lying.
Stretch hamstrings, gluteals and calves.
A proper sports massage helped mine a lot, but beware, it’s very painful.
Dave