You add sprinkles to cookies before you bake them. This way, the sprinkles will bake right into the cookies and will not fall off. If you're planning to frost your cookies, you can add sprinkles after baking, as the frosting will hold them in place.