The key here is not to follow builds, there are some builds which you can do almost no matter what your opponent does, but these are usually cheesy or all in.
The better thing to do would be to have a general idea of what you want to do, but only do so if it is safe or appropriate to do so.
The way you tell if it is safe is to scout. Look at what they're doing and eliminate what they can't be doing.
For instance if you scout they've invested into technology or economy then you know that they can't have any decent amount of army with which to attack you with. So you know that it'll be a good time for you to attack if you're set up to do so, or you could expand yourself.
If you notice that they have little in the way of tech and you notice a lot of production buildings, then they are probably gearing up for an attack so investing more into your army and technology will be better suited.
So you continue along your general plan, being safe until you scout something that makes you decide to adjust your plan to what they're doing. It can even be more specific, like you notice lots of zerglings and banelings so you get more sentries to forcefield, or you see they're getting a spire so you might wanna tech to thors and mix in more marines.
A safe general plan is to have three production buildings and one advancement in tech then expand. So for Terran it would be something like three raxes (the techlab is your piece of tech) then expand then 2 raxes and a factory (the factory and techlab on it is your tech) then expand, etc.
It's better to follow a plan instead of a build for various reasons, namely it teaches you to adapt plans instead of blindly doing the same thing and the other main point which I made in the comments is that new players CANNOT follow builds, because their macro is simply not good enough. You can't hit the timings if you have gaps in worker/unit production, if you're getting supply blocked or if you're floating a lot of resources.
Just following a plan allows you to focus more on your macro and you'll learn much faster. You'll discover on your own all these builds that people use. The builds come about because people followed the basic macro rules and discovered the best way to do things.
A quick example of this is the 9 pylon. If you build your pylon before that at 8 supply you will have to have a gap in probe production which is not good. If you do it at 10 supply you will get supply blocked (gap in probe production in this case). So that's why all (most) builds will say 9 pylon.
So to sum up; if you macro well, you'll just accidentally do 'correct' builds. Then the trick is to adapt your build to what your opponent is doing. The better you know what they're doing, the better you can adapt and therefore defeat them