I have read plenty of articles (particularly on here) about Parameter Sniffing in Stored Procedures and ways to get around it. For example, here: http://elegantcode.com/2008/05/17/sql-parameter-sniffing-and-what-to-do-about-it/
Does the same apply to a stored procedure that is called by another stored procedure? i.e. does the solution described in the linked article also apply to nested stored procedure.
Also if you declare a variable called @PersonID in the calling stored procedure, can you decalre a variable called @PersonID in the called stored procedure i.e. DECLARE PersonID int. This would be variable shadowing.
Yes to the first one. Each stored procedure is separate and you need to apply anti-sniffing techniques (parameter masking, or the newer OPTIMISE FOR UNKNOWN) in each stored procedure
Yes to the second, but not why you think. A variable has scope only in that stored procedure. So any @PersonID in the callee is unrelated to the @PersonID in the caller. If you don’t have @PersonID in the callee, then you the parent one isn’t in scope there