Baking powder is a leavening that reacts with any acidic ingredients in the dough as well as with heat. When it reacts, it creates air bubbles that lighten the mixture. Cookies typically are flat and spread due to the amount of butter in the cookie. First, make sure you are using real butter as substitutes contain water that cause spreading. You can also try using ½ butter, ½ shortening to make cookies a little cakier.