Danish cookies will spread a little when they bake, but they shouldn't spread excessively. If yours spread all over the baking sheet, then you either added too much sugar or liquid, or too little flour.