Here are two reasons why you have spots in your sugar cookie icing.
The butter from the cookie seeps into the royal icing. I’m guessing that it happens more when the cookies are drying in a warm/humid area because the butter isn’t as solid and melts up through the icing. Humidity is the real culprit. Recommend using a humidifier if you are experiencing this issue.
If your iced sugar cookies show spots in the icing after they are dry and you used a dehydrator while preparing them, this can be attributed to the powdered sugar. Try sifting the powdered sugar prior to mixing or switch brands.