How to replace handles? I've got an old bike from my friends, which basically looks good (just needs some oiling), but its handles are really beaten up and greesy. I couldn't find any screws or anything which keeps these handles in place - please see photo.

Is it possible to replace handles without replacing the whole gear switching mechanism?
The rubber degrades and goes super tacky and gross as you note. The rubber and plastic part does remove by pulling outwards - and could therefore be replaced - this is how you change cables on these SRAM gripshift. The problem however is that the rubber rotating part is probably not available as a spare part. The shifter unit itself is generally considered cheap enough as a whole.
Searching online for 'SRAM rotating grip assembly' does bring up some spare parts, though I can't see a straight match and they are about the same cost as a whole replacement unit. These seem to be for higher tier units.
A visit to your local SRAM Dealer might be helpful, they could look up the current spare parts catalogue with you and see if it's even listed as a spare, more categorically.
Bear in mind that replacement units come with their own inner cable, so it might be a reasonable time to go with new units and saving the cost of the inner cable as a nice part to freshen up too.