I answer on the assumption that medical problems have been ruled out and that the ‘pain’ is a result of chronic tightness.
Pain in the upper trapezius is often the result of poor posture, stemming from hours on the computer (or texting) with elevated and forward rounded shoulders and a head-forward position.
The strategy that I employ with my clients is first of all awareness. Many don’t even know that their shoulders are almost permanently attached to their earlobes, and having them realize this postural deficiency is my first priority. Next I develop exercises to strengthen the back muscles as appropriate, and I usually include the muscles of the rotator cuff as well. Also stretching of the front as well as exercises from the MELT method.
It is important, though, to emphasize good posture. I find that that this is half the battle when people tell you how they are now beginning to notice it.