Are you sure it's pain, as in pain, instead of discomfort? Are the muscles sore from use or are they tight? These are important distinctions. If the muscles are sore and painful from overexercise for months on end, it can be something worse and it could be a good idea to see a medical professional. If they're just tight because your working position etc. there's a lot you can do for them.
When it comes to exercise, I find loaded carries are the best thing to help with tight traps. Some rows also work beautifully. With both you should feel the difference after five minutes of exercise. I rarely get my traps/shoulders/neck in discomfort, but whenever in the past I got any kind of discomfort, I asked my then boss for a chance to do some logistics that day. No matter how intense the discomfort was, after a half an hour or so of heavy carrying it was mostly gone and all gone by the end of the day. The kind of carries I recommend is the suitcase one, on both or either hand, and something to carry on your shoulder. Like a heavy log or a bag of gypsum or whatever.
When it comes to dealing with the reasons for the tightness instead of the aftermath, posture and ergonomics are key. Keep your keyboard, mice and monitor below you. Have the input devices near you so you don't have to reach for them. Sit straight and have your chest out a bit and shoulders down. Get up as much and as often as possible. When it comes to having to do something unergonomic, as in for example reaching for something in a bad position, avoid staying staticly in the position.