This usually isn't a problem when the salad is served soon after making it, but if you want to make it in advance you could toss the cooked macaroni in a bit of olive oil before adding the mayonnaise dressing.