Normally, there is a small tab on the switch housing that goes into a small hole in the handle bars to keep it from moving.
If that tab is gone, like you are experiencing, the housing will rotate.
One thing you could try is to get a thin strip of rubber to go between the housing and the bars.
A strip of sandpaper (cloth backed would be best) could probably also work well.
A strip of aluminium from a beer or soda can also makes a good shim
VROC # 30581
2009 1700 Nomad (mine)
2003 VN750 "Prozac" (now hers)
25'000 miles at purchase
So, why is a raven like a writing desk?