We investigated the in-plane resistivity anisotropy for underdoped Ba(Fe$_{1-x}$Co$_x$)$_2$As$_2$ single crystals with improved quality. We demonstrate that the anisotropy in resistivity in the magnetostructural ordered phase arises from the anisotropy in the residual component which increases in proportion to the Co concentration $x$. This gives evidence that the anisotropy originates from the impurity scattering by Co atoms substituted for the Fe sites, rather than so far proposed mechanism such as the anisotropy of Fermi velocities of reconstructed Fermi surface pockets. As doping proceeds to the paramagnetic-tetragonal phase, a Co impurity transforms to a weak and isotropic scattering center.