The singer will take time out from his reunion with Take That to compose the track for Jonathan Wilkes's stage musical Pantos On Strike.
"Robbie's writing the first song for the show," Wilkes told the Manchester Evening News.
"He agreed to do that before he agreed to the Take That comeback."
Wilkes described the show, which he will star in alongside comedian Paddy McGuinness, as "a little bit risque" and "definitely not for the children."
Williams added: "It isn't written yet, I hope I get it together."
> Take That film 'The Flood' music video