It is very important to use the correct ingredients at the right temperatures to ensure the cookies hold their shape while baking. Two main reasons why these cookies might spread is either not using cold butter or using expired baking powder/ using baking soda instead of baking powder. I have found that these cookies come out best when I stick to using cold butter and fresh baking powder.