Sunroof Control Module Programming and Setup: Notes
WARNING: This page does not describe the selected car, but rather 6 other vehicles, including the 2016 GMC Sierra 3500 HD, 2016 GMC Sierra 2500 HD, 2016 GMC Sierra 1500, 2016 Chevrolet Silverado 3500 HD, and 2016 Chevrolet Silverado 2500 HD. However, it is still accessible from the selected car via links, so may be relevant.
When replacing the sunroof motor/control module, the sunroof motor/actuator initialization/teach procedure must be followed.