Most of the time when I was studying, I was studying classical music. So, any music other than the specific music I was studying would have been incredibly distracting.
In general, I think it really depends. As a musician, I tend to pay a lot of attention to music, so if music is playing it can be distracting. But If I can find the right music, it can help get me in a good frame of mind.