So that's the background on how the UV light acts and disrupts a cells ability to survive. Now, about your question on how could a virus evolve if UV light kills it. Easy... the virus doesn't spend a ton of time outside of your body. Most transmission is person-to-person, there isn't a ton of person-to-surface-to-person spread therefore it's not like the virus is sitting on a handrail in the sun for days. Also, as I mentioned above, some mutations don't result in any change. There is a lot of redundancy in the DNA code (see DNA codon table 1). Not every combination produces a unique aminoacid.
1 - https://en.wikipedia.org/wiki/DNA_codon_table
My microbiology background is a bit dated, so my facts might be a bit off here and there.