A method of simulating the neutron scattering by a textured polycrystal is presented. It is based on an expansion of the scattering cross sections in terms of the spherical harmonics of the incident and scattering directions, which is derived from the generalized Fourier expansion of the polycrystal orientation distribution function. The method has been implemented in a Monte Carlo code as a component of the McStas software package, and it has been validated by computing some pole figures of a Zircaloy‐4 plate and a Zr–2.5Nb pressure tube, and by simulating an ideal transmission experiment. The code can be used to estimate the background generated by components of neutron instruments such as pressure cells, whose walls are made of alloys with significant crystallographic texture. As a first application, the effect of texture on the signal‐to‐noise ratio was studied in a simple model of a diffraction experiment, in which a sample is placed inside a pressure cell made of a zirconium alloy. With this setting, the results of two simulations were compared: one in which the pressure‐cell wall has a uniform distribution of grain orientations, and another in which the pressure cell has the texture of a Zr–2.5Nb pressure tube. The results showed that the effect of the texture of the pressure cell on the noise of a diffractogram is very important. Thus, the signal‐to‐noise ratio can be controlled by appropriate choice of the texture of the pressure‐cell walls.