In preparing sulphonilamide, why is aniline acylated if the acyl group has to be removed later?
The main problem encountered during electrophilic substitution
reactions of aromatic amines is that of their very high reactivity.
Substitution tends to occur at ortho- and para-positions. If we
have to prepare monosubstituted aniline derivative, how can
the activating effect of –NH2
 group be controlled ? 

This can be done by protecting the -NH2 group by acetylation with acetic
anhydride, then carrying out the desired substitution followed
by hydrolysis of the substituted amide to the substituted amine



The lone pair of electrons on nitrogen of acetanilide interacts
with oxygen atom due to resonance as shown below:



Hence, the lone pair of electrons on nitrogen is less available for
donation to benzene ring by resonance. Therefore, activating
effect of –NHCOCH3
group is less than that of amino group.

Moreover, in the
strongly acidic medium, aniline is protonated to form the
anilinium ion which is meta directing.


However, by protecting the –NH2
 group by acetylation reaction
with acetic anhydride, the reaction can be controlled
and the p derivative can be obtained as the major product.



source: word to word from 
NCERT(INDIA) CLASS 12 chemistry ;)
http://ncert.nic.in/NCERTS/l/lech204.pdf