By combining transport measurements and optical second harmonic generation, we have investigated heterostructures formed between crystalline thin films of LaAlO3, with varying stoichiometry and TiO2-terminated SrTiO3(001) substrates. Optical second harmonic generation directly probes the polarity of these heterostructures, thus complementing the transport data. The stoichiometry and the growth temperature are found to be critical parameters for controlling both the interfacial conductivity and the heterostructure polarity. In agreement with the previous work, all of the samples display an insulator-to-metal transition in the Al-reach region, with the conductivity first increasing and then saturating at the highest Al/La ratios. The second harmonic signal also increases as a function of the Al/La ratio, but, at the highest growth temperature, it does not saturate. This unusual behavior is consistent with the formation of an ordered structure of defect dipoles in the LaAlO3 film caused by the off-centering of excess Al atoms in agreement with the theory.