Exhibit 10.31

AMENDMENT TO EMPLOYMENT AGREEMENT

THIS
AMENDMENT TO EMPLOYMENT AGREEMENT is entered into as of December 22, 2009, by and between Heritage Bankshares, Inc., a Virginia corporation (hereinafter referred to as Bankshares), Heritage Bank, a Virginia corporation, and Michael
S. Ives (the Executive).

RECITALS

Bankshares, Bank and Executive previously entered into an Employment Agreement as of February 7, 2005 (Employment Agreement), which has been amended subsequently; and

Bankshares, Bank and Executive desire to amend the Employment Agreement as further provided herein.

NOW, THEREFORE, in consideration of the mutual promises of the parties hereto and for other good and valuable consideration, the receipt and
adequacy whereof each party hereby acknowledges, Bankshares, Bank and Executive hereby agree that effective January 1, 2009, the Employment Agreement is hereby amended to read as follows:



|1. | A new paragraph is added to the end of Section 1(d) of the Employment Agreement, Change of Control, to read as follows:
|-- | -----------------------------------------------------------------------------------------------------------------------

Notwithstanding the foregoing, a Change in Control shall be deemed to occur under the Employment Agreement only to the extent any triggering
business transaction constitutes a change in the ownership or effective control of Bankshares, or in the ownership of a substantial portion of the assets of Bankshares, as determined under Code Section 409A and Treasury Regulations issued
thereunder from time to time.



---

|2. | A new sentence is added to the end of Section 5 to read as follows:
|-- | -------------------------------------------------------------------

The annual incentive bonus, if any, shall be paid to the Executive in a single lump sum no later than
March 15thof the calendar year following the
applicable performance year.



|3. | A new sentence shall be added to the end of Section 9(b) to read as follows:
|-- | ----------------------------------------------------------------------------

Such additional compensation and accrued and unused leave payments shall be paid in a single lump sum within 30 days from Executives
date of death.



|4. | A new Section 22 is added to read as follows:
|-- | ---------------------------------------------

22. INTERNAL REVENUE CODE SECTION 409A/CONTINUATION OF BENEFITS/REIMBURSEMENTS

This Agreement is intended to and shall comply with Internal Revenue Code Section 409A. All references to a termination of employment and separation from service shall mean and be administered to
comply with the definition of separation from service in Code Section 409A.

All reimbursements provided
under this Agreement shall comply with Code Section 409A and shall be subject to the following requirements:



| | (a) | The amount of expenses eligible for reimbursement, during the Executives taxable year may not affect the expenses eligible for reimbursement to be provided in
another taxable year, and
| | --- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



| | (b) | The reimbursement of an eligible expense must be made by December 31 following the taxable year in which the expense was incurred.
| | --- | ----------------------------------------------------------------------------------------------------------------------------------

The right to reimbursement is not subject to liquidation or exchange for another benefit.

To the extent that any amount payable under this Agreement constitutes deferred compensation under Code Section 409A (and
is not otherwise excepted from Code Section 409A coverage by virtue of being considered separation pay or a short term deferral or otherwise) and is payable to Executive, based upon a separation from service (other than
death or disability as defined under Code Section 409A), such amount shall not be paid until the first day following the six-month anniversary of Executives separation from service.

Any right to a series of installment payments shall be treated as a right to a series of separate payments for purposes of Code
Section 409A.

Payment of any unused vacation or sick leave, unless expressly provided otherwise herein shall be made in
a single lump sum within 30 days of separation from service.



2



---

IN WITNESS WHEREOF, the parties have executed this Amendment effective as of the date first
above written.



|                        |  |  |  |                           |  |                           
|----------------------- |  |  |  | ------------------------- |  | --------------------------
|                        |  |  |  | EXECUTIVE                
|                        |  | 
|Date: December 22, 2009 |  |  |  | /s/ Michael S. Ives      
|                        |  |  |  | Michael S. Ives          
|                        |  | 
|                        |  |  |  | HERITAGE BANKSHARES, INC.
|                        |  |  | 
|Date: December 22, 2009 |  |  |  | By:                       |  | /s/ Peter M. Meredith, Jr.
|                        |  |  |  |                           |  | Chairman of the Board     
|                        |  | 
|                        |  |  |  | HERITAGE BANK            
|                        |  |  | 
|Date: December 22, 2009 |  |  |  | By:                       |  | /s/ Peter M. Meredith, Jr.
|                        |  |  |  |                           |  | Chairman of the Board     



3