The best way to thicken royal icing is to add more powdered sugar. I recommend adding it gradually until you get the thick royal icing you want, while not making the royal icing taste too sweet.