Hydrolysis of nitrile is pH dependent. It will lead to formation of different products based on pH.
Theoretically, nitrile hydrolyze to form amide and then ammonium salt.
$$\ce{RCN ->[H2O] RCONH2 ->[H2O] RCOONH4}$$
But in practice, the reaction between nitriles and water is so slow that it is considered negligible. The nitrile is instead heated with either a dilute acid such as dilute hydrochloric acid, or with an alkali such as sodium hydroxide solution to accelerate the hydrolysis reaction. But this pH dependent reaction yields different products.
- Acid hydrolysis: yields carboxylic acid
$$\ce{RCN + 2H2O + HCl -> RCOOH + NH4Cl}$$
- Alkaline hydrolysis: yields sodium carboxylate salt
$$\ce{RCN + H2O + NaOH-> RCOONa + NH3}$$
To obtain amide, hydrolysis is done selectively and in controlled manner. It can be done in both acidic and alkaline medium. In acidic medium, nitriles are converted into amide in a single step process using TFA-$\ce{H2SO4}$ mixture as reagent.

In alkaline medium, it can done using alkaline solution of hydrogen peroxide (see @Light Yagami's answer).
Reference
- Chemguide
- Facile and Highly Selective Conversion of Nitriles to Amides via Indirect Acid-Catalyzed Hydration Using TFA or AcOH−H2SO4, Jarugu Narasimha Moorthy and Nidhi Singhal, The Journal of Organic Chemistry 2005 70 (5), 1926-1929
DOI: 10.1021/jo048240a