FIELD: soil or rock drilling.SUBSTANCE: invention relates to drilling wells and can be used to detect a magnetizable structure in an underground environment. Drilling apparatus comprising a drill bit, a downhole drilling direction control system coupled to a drill bit and comprising a drilling direction control controller is provided, a system of magnetic resistance sensors comprising at least one sensor and two or more magnets mounted to create an ejecting effect, a computer disposed on the surface, communicatively coupled to at least one sensor and a drilling direction control controller. At least one sensor is aligned in the longitudinal direction in the center between two or more magnets and is radially oriented to detect the maximum pushing field in the radial direction from the sensor system. Computer located on the surface contains a set of instructions that, when executed by a computer located on the surface, cause the computer on the surface to receive the results of magnetic flux measurements from t