Actually, no. The cockpit has a different air circulation system from the rest of the aircraft. A pilot or mechanic can add the technical details, but from what I understand the pilot air is cleaner as it is filtered more or is from a cleaner source. In addition, higher relative humidity is maintained in the cockpit. Aircraft cabin air is extremely dry, and dry nasal passages and sinus membranes are more susceptible to viruses.
Finally, the pilots have much less interaction with the passengers. The cockpit is literally walled off from the hacking, sneezing, and vomiting masses. The pilots are rarely coughed on by an ill passenger, or have a diry diaper or snot rag thrust in their hands with no warning or time to adequately protect themselves, or have to pick up used eating and drinking untensils or deal with trash.
Of course this is all part of the job so I am not complaining, but it is not surprising to me that F/As have a somewhat higher sick leave usage than other work groups. In addition to the above, they also have to deal with crazy work schedules, travel, and jeg lag (three things they DO have in common with the pilots).